﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Tradex.ComponentModel;

namespace Tradex.Tests.ComponentModel {

    /// <summary>
    /// Tests the Dispatcher.
    /// </summary>
    [TestClass]
    public class DispatcherTests {

        //Test via two different dispatches.
        [TestMethod ()]
        public void Functionality() {

            bool one = false;
            bool two = true;

            Dispatcher<object> dispatcher = new Dispatcher<object>();
            dispatcher.Register<int>(item => one = true);
            dispatcher.Register<long>(item => two = false);

            dispatcher.Dispatch((int)5);
            dispatcher.Dispatch((long)10);

            Assert.AreEqual(true, one, "one false falue");
            Assert.AreEqual(false, two, "two false value");

        }

    }
}
